<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%// Redirect to login page if the user has not logged in
    if (session.getAttribute("authorized") == null) {
        System.out.println("User is not logged in.");

        session.setAttribute("authorized", false);
    }
    if ((Boolean) session.getAttribute("authorized") == false) {
        System.out.println("Recirect to login.jsp");
        pageContext.forward("login.jsp");
    }
%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="style.css"/>
        <title>GrApReSys</title>
    </head>
    <body>
        <h1>Graduate Application Review System</h1>
        <%@ include file="menu.jsp" %>
        <div id="display">
            <%
                Object displayPage = session.getAttribute("displayPage");
                if (displayPage == null) {
            %>
            <%@ include file="home.jsp" %>
            <%            } else if (displayPage.equals("upload")) {
            %>
            <%@ include file="upload.jsp" %>
            <%            } else if (displayPage.equals("createAssignment")) {
            %>
            <%@ include file="createAssignment.jsp" %>
            <%                } else if (displayPage.equals("profile")) {
            %>
            <%@ include file="profile.jsp" %>
            <%                } else if (displayPage.equals("downloadPDF")) {
            %>
            <%@ include file="downloadPDF.jsp" %>
            <% } else if (displayPage.equals("viewTableOfApplications")) {%>
            <%@ include file="viewTableOfApplications.jsp" %>
            <%} else if (displayPage.equals("application")) {%>
            <%@ include file="application.jsp" %>
            <% } else if (displayPage.equals("encrypt")) {%>
            <%@ include file="encrypt.jsp" %>
            <%} else if (displayPage.equals("oldReviews")){%>
            <%@ include file="oldReviews.jsp" %>
            <%}%>
        </div>
    </body>
</html>
